Method and Device for Feedback Control of Neural Stimulation

ABSTRACT

A method of controlling a neural stimulus by use of feedback. The neural stimulus is applied to a neural pathway in order to give rise to an evoked action potential on the neural pathway. The stimulus is defined by at least one stimulus parameter. A neural compound action potential response evoked by the stimulus is measured. From the measured evoked response a feedback variable is derived. A feedback loop is completed by using the feedback variable to control the at least one stimulus parameter value. The feedback loop adaptively compensates for changes in a gain of the feedback loop caused by electrode movement relative to the neural pathway.

Technical Field

The present invention relates to controlling a neural response to a stimulus, and in particular relates to measurement of a compound action potential by using one or more electrodes implanted proximal to the neural pathway, in order to provide feedback to control subsequently applied stimuli.

BACKGROUND OF THE INVENTION

There are a range of situations in which it is desirable to apply neural stimuli in order to give rise to a compound action potential (CAP). For example, neuromodulation is used to treat a variety of disorders including chronic pain, Parkinson's disease, and migraine. A neuromodulation system applies an electrical pulse to tissue in order to generate a therapeutic effect. When used to relieve chronic pain, the electrical pulse is applied to the dorsal column (DC) of the spinal cord. Such a system typically comprises an implanted electrical pulse generator, and a power source such as a battery that may be rechargeable by transcutaneous inductive transfer. An electrode array is connected to the pulse generator, and is positioned in the dorsal epidural space above the dorsal column. An electrical pulse applied to the dorsal column by an electrode causes the depolarisation of neurons, and generation of propagating action potentials. The fibres being stimulated in this way inhibit the transmission of pain from that segment in the spinal cord to the brain. To sustain the pain relief effects, stimuli are applied substantially continuously, for example at a frequency in the range of 30 Hz-100 Hz.

Neuromodulation may also be used to stimulate efferent fibres, for example to induce motor functions. In general, the electrical stimulus generated in a neuromodulation system triggers a neural action potential which then has either an inhibitory or excitatory effect. Inhibitory effects can be used to modulate an undesired process such as the transmission of pain, or to cause a desired effect such as the contraction of a muscle.

The action potentials generated among a large number of fibres sum to form a compound action potential (CAP). The CAP is the sum of responses from a large number of single fibre action potentials. The CAP recorded is the result of a large number of different fibres depolarising. The propagation velocity is determined largely by the fibre diameter and for large myelinated fibres as found in the dorsal root entry zone (DREZ) and nearby dorsal column the velocity can be over 60 ms⁻¹. The CAP generated from the firing of a group of similar fibres is measured as a positive peak potential P1, then a negative peak N1, followed by a second positive peak P2. Depending on the polarity of sense electrodes the CAP equivalently may present in the measurement with the opposite polarity, in which case the nomenclature N1-P1-N2 is used. In either case this is caused by the region of activation passing the recording electrode as the action potentials propagate along the individual fibres. An observed CAP signal will typically have a maximum amplitude in the range of microvolts, whereas a stimulus applied to evoke the CAP is typically several volts.

Conventionally, spinal cord stimulation (SCS) delivers stimulation to the dorsal column at a fixed current. When a subject moves or changes posture the distance between the spinal cord and the implanted lead varies, resulting in an increase or decrease in the amount of current received by the dorsal columns. These changes in current result in changes to recruitment and paresthesia, which can reduce the therapeutic effect of SCS and can create side effects including over-stimulation.

If a stimulus is of an amplitude and/or peak width and/or has other parameter settings which put it below the recruitment threshold, delivery of such a stimulus will fail to recruit any neural response. Thus, for effective and comfortable operation, it is necessary to maintain stimuli amplitude or delivered charge above the recruitment threshold. It is also necessary to apply stimuli which are below a comfort threshold, above which uncomfortable or painful percepts arise due to increasing recruitment of Aδ fibres which are thinly myelinated sensory nerve fibres associated with joint position, cold and pressure sensation. In almost all neuromodulation applications, a single class of fibre response is desired, but the stimulus waveforms employed can recruit action potentials on other classes of fibres which cause unwanted side effects, such as muscle contraction if motor fibres are recruited. The task of maintaining appropriate stimulus amplitude is made more difficult by electrode migration and/or postural changes of the implant recipient, either of which can significantly alter the neural recruitment arising from a given stimulus, depending on whether the stimulus is applied before or after the change in electrode position or user posture. Postural changes alone can cause a comfortable and effective stimulus regime to become either ineffectual or painful.

Another control problem, facing neuromodulation systems of all types, is achieving neural recruitment at a sufficient level required for therapeutic effect, but at minimal expenditure of energy. The power consumption of the stimulation paradigm has a direct effect on battery requirements which in turn affects the device's physical size and lifetime. For rechargeable systems, increased power consumption results in more frequent charging and, given that batteries only permit a limited number of charging cycles, ultimately this reduces the implanted lifetime of the device.

Any discussion of documents, acts, materials, devices, articles or the like which has been included in the present specification is solely for the purpose of providing a context for the present invention. It is not to be taken as an admission that any or all of these matters form part of the prior art base or were common general knowledge in the field relevant to the present invention as it existed before the priority date of each claim of this application.

Throughout this specification the word “comprise”, or variations such as “comprises” or “comprising”, will be understood to imply the inclusion of a stated element, integer or step, or group of elements, integers or steps, but not the exclusion of any other element, integer or step, or group of elements, integers or steps.

In this specification, a statement that an element may be “at least one of” a list of options is to be understood that the element may be any one of the listed options, or may be any combination of two or more of the listed options.

SUMMARY OF THE INVENTION

According to a first aspect the present invention provides an automated method of controlling a neural stimulus, the method comprising:

applying the neural stimulus to a neural pathway in order to give rise to an evoked action potential on the neural pathway, the stimulus being defined by at least one stimulus parameter;

measuring a neural compound action potential response evoked by the stimulus, and deriving from the measured evoked response a feedback variable;

completing a feedback loop by using the feedback variable to control the at least one stimulus parameter value; and

adaptively compensating for changes in a gain of the feedback loop caused by electrode movement relative to the neural pathway.

According to a second aspect the present invention provides an implantable device for controllably applying a neural stimulus, the device comprising:

a plurality of electrodes including one or more nominal stimulus electrodes and one or more nominal sense electrodes;

a stimulus source for providing a stimulus to be delivered from the one or more stimulus electrodes to a neural pathway in order to give rise to an evoked action potential on the neural pathway;

measurement circuitry for recording a neural compound action potential signal sensed at the one or more sense electrodes; and

a control unit configured to:

-   -   control application of a neural stimulus as defined by at least         one stimulus parameter;     -   measure via the measurement circuitry a neural compound action         potential response evoked by the stimulus;     -   determine from the measured evoked response a feedback variable;     -   complete a feedback loop by using the feedback variable to         control the at least one stimulus parameter value; and     -   adaptively compensate for changes in a gain of the feedback loop         caused by electrode movement relative to the neural pathway.

According to a third aspect the present invention provides a non-transitory computer readable medium for controllably applying a neural stimulus, comprising the following instructions for execution by one or more processors:

computer program code means for applying the neural stimulus to a neural pathway in order to give rise to an evoked action potential on the neural pathway, the stimulus being applied as defined by at least one stimulus parameter;

computer program code means for measuring a neural compound action potential response evoked by the stimulus and deriving from the measured evoked response a feedback variable;

computer program code means for completing a feedback loop by using the feedback variable to control the at least one stimulus parameter value; and

computer program code means for adaptively compensating for changes in a gain of the feedback loop caused by electrode movement relative to the neural pathway.

The present invention recognises that (i) recruitment of evoked compound action potentials upon the neural pathway by a given stimulus will vary based on the distance of the stimulus electrode(s) from the neural pathway, and (ii) the observed amplitude of a given ECAP upon the neural pathway will vary based on the distance of the sense electrode(s) from the neural pathway, so that electrode movement as may be caused by patient movement, postural changes, heartbeat or the like will affect the feedback loop gain of a system using feedback control of the stimulus.

In some embodiments of the invention, adaptively compensating for changes in the feedback loop may comprise maintaining a corner frequency of the feedback loop at a desired value or within a desired range. For example the desired value or range of the corner frequency may be selected to suitably attenuate low frequency noise such as heartbeat as well as high frequency noise such as electrical amplifier noise. Moreover, in some embodiments, the desired value or range of the corner frequency may be selected to bias attenuation of heartbeat and noise while the recipient is in a more or most sensitive posture, as compared to when the recipient is in a less sensitive posture, sensitive postures being those with a steeper slope of an ECAP growth curve.

In some embodiments of the invention the feedback loop could be a first order feedback loop. Alternatively, the feedback loop could be a second order feedback loop, or higher order feedback loop.

In some embodiments the feedback loop is further configured to adaptively compensate for electrical noise, such as amplifier noise, EMG noise, and neural activity not evoked by the implant.

Some embodiments of the present invention recognise that a slope P of the ECAP growth curve varies with the distance d of the electrode array from the nerve fibre or fibres, so that P is some function of d. Such embodiments of the present invention also recognise that the stimulus threshold T, being the minimum stimulus current at which a neural response will be evoked, also varies with d, so that T is some function of d.

In such embodiments, the slope P can be expressed as a function of T. While d is difficult to determine precisely and is thus often an unknown, T and P can be regularly or substantially continuously measured or estimated by applying stimuli of varying amplitude to explore the slope P of the ECAP amplitude growth and determine a zero intercept, i.e., the threshold T, at any given time.

In some such embodiments, an estimation unit may be provided which produces an estimate P′ of the slope P. The estimation P′ may in some embodiments be produced by the estimation unit from an empirical relationship of stimulus current to measured ECAP amplitude, and for example may be estimated as P′=(V+K)/I, where V is ECAP amplitude, K is a constant or function which relates P to a stimulus threshold T, for example K=P.T, and I is stimulus current amplitude. In such embodiments, the estimate P′ may then be introduced into the feedback loop to counteract the effect of P. For example, an error signal of the feedback loop may be scaled by 1/P′.

The feedback variable could in some embodiments be any one of: an amplitude; an energy; a power; an integral; a signal strength; or a derivative, of any one of: the whole evoked compound action potential; the fast neural response for example in the measurement window 0-2 ms after stimulus; the slow neural response for example in the measurement window 2-6 ms after stimulus; or of a filtered version of the response. The feedback variable could in some embodiments be an average of any such variable determined over multiple stimulus/measurement cycles. The feedback variable may in some embodiments be the zero intercept, or the slope, of a linear portion of the response of AP amplitude to varying stimulus current. In some embodiments the feedback variable may be derived from more than one of the preceding measures.

The control variable, or stimulus parameter, could in some embodiments be one or more of the total stimulus charge, stimulus current, pulse amplitude, phase duration, interphase gap duration or pulse shape, or a combination of these.

The present invention thus recognises that using a feedback loop to maintain a constant ECAP is a difficult task as changes in patient posture both create signal inputs and change the loop characteristics. Choosing an optimum corner frequency for the loop is a tradeoff between obtaining optimum noise rejection and optimum loop speed. This tradeoff is made more challenging with variations in loop gain.

The set point of the feedback loop may be configured so as to seek a constant value of ECAP amplitude, or may be configured to seek a target ECAP amplitude which changes over time, for example as defined by a therapy map as described in International Patent Application Publication No. WO2012155188 by the present applicant, the content of which is incorporated herein by reference.

BRIEF DESCRIPTION OF THE DRAWINGS

An example of the invention will now be described with reference to the accompanying drawings, in which:

FIG. 1 schematically illustrates an implanted spinal cord stimulator;

FIG. 2 is a block diagram of the implanted neurostimulator;

FIG. 3 is a schematic illustrating interaction of the implanted stimulator with a nerve;

FIG. 4 is a system schematic illustrating elements and inputs of a feedback loop involving the device of FIG. 3, for maintaining neural recruitment at a desired level or upon a desired locus;

FIG. 5 conceptually illustrates signal interaction in the system of FIGS. 3 and 4;

FIG. 6 illustrates the variation in the slope of the growth curve of the ECAP response amplitude, with changing posture;

FIG. 7 is a continuous time representation of a first order feedback loop in accordance with one embodiment of the present invention;

FIG. 8 illustrates the loop of FIG. 7 with simple inputs;

FIG. 9 is a signal flow graph of the continuous time loop with simple inputs of FIG. 8;

FIG. 10 is a Bode plot of the transfer function of the loop of FIGS. 8-9;

FIG. 11 illustrates variations in attenuation of low frequency heartbeat and high frequency noise, respectively, by the continuous time loop of FIG. 8, in response to changes in recipient posture;

FIG. 12 illustrates variations in attenuation of low frequency heartbeat and high frequency noise, respectively, by a discrete time or sampled data loop equivalent to the continuous time loop of FIG. 8, in response to changes in recipient posture;

FIG. 13 illustrates variations in attenuation of low frequency heartbeat and high frequency noise, respectively, by a second-order sampled data loop, in response to changes in recipient posture;

FIG. 14 illustrates a continuous time model of the second order loop reflected in FIG. 13;

FIG. 15 illustrates the a second order controller in the z-domain, equivalent to the continuous time model of FIG. 14;

FIG. 16 illustrates a feedback loop comprising P estimation in accordance with another embodiment of the present invention;

FIG. 17a is a graph showing ECAP amplitude over time during changes in recipient posture, without feedback control, while FIG. 17b is a graph showing ECAP amplitude over time during changes in recipient posture, with feedback active;

FIG. 18 shows RMS variation of the response from the comfort level;

FIG. 19 shows the comparison of user perception between feedback and non-feedback;

FIG. 20 shows a user's perception of paraesthesia continuity across various postures; and

FIG. 21 illustrates perceived paraesthesia variation ratings across postures.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

FIG. 1 schematically illustrates an implanted spinal cord stimulator 100. Stimulator 100 comprises an electronics module 110 implanted at a suitable location in the patient's lower abdominal area or posterior superior gluteal region, and an electrode assembly 150 implanted within the epidural space and connected to the module 110 by a suitable lead.

FIG. 2 is a block diagram of the implanted neurostimulator 100. Module 110 contains a battery 112 and a telemetry module 114. In embodiments of the present invention, any suitable type of transcutaneous communication, such as infrared (IR), electromagnetic, capacitive and inductive transfer, may be used by telemetry module 114 to transfer power and/or data between an external device and the electronics module 110.

Module controller 116 has an associated memory 118 storing patient settings 120, control programs 122 and the like. Controller 116 controls a pulse generator 124 to generate stimuli in the form of current pulses in accordance with the patient settings 120 and control programs 122. Electrode selection module 126 switches the generated pulses to the appropriate electrode(s) of electrode array 150, for delivery of the current pulse to the tissue surrounding the selected electrode. Measurement circuitry 128 is configured to capture measurements of neural responses sensed at sense electrode(s) of the electrode array as selected by electrode selection module 126.

FIG. 3 is a schematic illustrating interaction of the implanted stimulator 100 with a nerve 180, in this case the spinal cord however alternative embodiments may be positioned adjacent any desired neural tissue including a peripheral nerve, visceral nerve, parasympathetic nerve or a brain structure. Electrode selection module 126 selects a stimulation electrode 2 of electrode array 150 to deliver an electrical current pulse to surrounding tissue including nerve 180, and also selects a return electrode 4 of the array 150 for stimulus current recovery to maintain a zero net charge transfer.

Delivery of an appropriate stimulus to the nerve 180 evokes a neural response comprising a compound action potential which will propagate along the nerve 180 as illustrated, for therapeutic purposes which in the case of spinal cord stimulator for chronic pain might be to create paraesthesia at a desired location.

The device 100 is further configured to sense the existence and intensity of compound action potentials (CAPs) propagating along nerve 180, whether such CAPs are evoked by the stimulus from electrodes 2 and 4, or otherwise evoked. To this end, any electrodes of the array 150 may be selected by the electrode selection module 126 to serve as measurement electrode 6 and measurement reference electrode 8. Signals sensed by the measurement electrodes 6 and 8 are passed to measurement circuitry 128, which for example may operate in accordance with the teachings of International Patent Application Publication No. WO2012155183 by the present applicant, the content of which is incorporated herein by reference.

Described below are a number of embodiments of the present invention for optimizing the tradeoff between noise and loop response in the presence of variations in loop gain due to mechanical changes in the electrode-to-nerve distance d.

Referring to FIG. 4, the feedback loop 400 comprises stimulator A which takes a stimulation current value and converts it into a stimulation pattern defining a pulse width, number of electrodes and the like, to produce an electrical pulse on the stimulation electrodes 2 and 4. In this embodiment the stimulus parameters are: alternating phase on/off, number of phases, number of stimulus electrode poles (bipolar, tripolar etc), pulse width, stimulus position, stimulus to measurement distance, stimulus rate. The stimulation output by stimulator A thus has a summary value m, usually the pulse amplitude, which is controlled by the feedback loop 400.

The stimulus crosses from the electrodes 2,4 to the spinal cord 180. However the neural recruitment arising from this is affected by mechanical changes in d, including posture changes, walking, breathing, heartbeat and so on. The stimulus also generates an evoked response y which may be approximated by the equation y=P(m−T) where T is the stimulus threshold and P is the slope of the response function. Various sources of noise n add to the evoked response y before it is measured, including (a) artifact, which is dependent on both stimulus current and posture; (b) electrical noise from external sources such as 50 Hz mains power; (c) electrical disturbances produced by the body such as neural responses evoked not by the device but by other causes such as peripheral sensory input, ECG, EMG; and (d) electrical noise from amplifiers 128. FIG. 5 conceptually illustrates signal interaction in the system.

The evoked response is amplified in the hardware sensor H then detected by the detector F. The measured evoked response amplitude f is then used as the feedback term for the loop 400, being compared to the setpoint s to produce an error e which is fed to the loop controller E. The feedback term can only be provided to the next stimulus, so there is a net delay of one sample round the loop.

Two clocks (not shown) are used in this embodiment, being a stimulus clock operating at ˜60 Hz and a sample clock for measuring the evoked response y operating at ˜10 KHz. As the detector is linear, only the stimulus clock affects the dynamics of the feedback loop 400.

The ECAP amplitude f can be used in feedback loop 400 to maintain constant paraesthesia and/or to maintain ECAP amplitude upon a predefined locus configured to allow subjects to receive consistent comfortable stimulation in every posture.

FIG. 6 illustrates the variation in the slope of the growth curve of the ECAP response amplitude, with changing posture. While only three postures are shown in FIG. 6, the ECAP growth curve for any given posture can lie between or outside the curves shown, on a continuously varying basis depending on posture, with the curve moving at unpredictable times whenever the patient moves or changes posture. Notably, the growth curve changes with posture in a manner whereby the stimulus threshold current changes, as indicated at Threshold 1, Threshold 2, Threshold 3 in FIG. 6, but the slope of the growth curve also changes, as indicated by Slope 1, Slope 2, Slope 3 in FIG. 6. The present invention recognises that at a posture producing a small threshold stimulus current, the growth curve slope will be larger (steeper) while at a posture producing a larger threshold stimulus current, the growth curve slope will be smaller. Thus, the growth curve slope P reduces as threshold T increases. One assumption can be that P=K/T where K is some constant.

In a first embodiment a first order loop transfer function can be formulated in order to provide suitable feedback control in this scenario. FIG. 7 shows the first level of simplification of the loop with a first-order controller. For the purposes of analysis and simulation, there are three inputs: 1 The set point c. Once set, this is left at a single value for long periods. 2. Changes in mechanical state v. This signal input models posture change, heartbeat, breathing etc. Most of these signals have primary components below 2 Hz. 3. Noise n. This consists mainly of amplifier noise, EMG and non-evoked responses.

The requirements of the loop can be summarized as: 1. The gain from c to y must be 1 at DC, i.e. the loop should target its set-point. 2. Minimize y/v. i.e. keep y constant in the presence of mechanical variations. 3. Minimize n/v. i.e. keep the ECAP constant in the presence of electrical noise. For this analysis, artifact is ignored.

The description starts using Laplace transforms as it is easier to predict the behaviour, though the various implementations use the Z transform. FIG. 7 shows a first order loop. The term “G” is a simple constant multiplier. As can be seen,

Y=P(d)(m−T(d))

The present invention recognises that a perturbation via the input v injects a signal. The injected signal can be estimated from the differential:

$\frac{dy}{dd} = {{\frac{dP}{dd}\left( {m - T} \right)} + {P\frac{dT}{dd}}}$

Even though d is unknown this equation is enlightening as, when (m−T)>0 both changes in P and changes in T create an apparent input signal at the patient transfer element.

The present invention recognises that a perturbation via the input v, i.e. the changes in P, also affect the loop in a second way, by changing the loop gain.

For the remainder of this analysis the inputs via the patient transfer element are treated from the point of view of the two separate effects: the input v, which directly affects the output, and the input P, which affects the loop gain but does not form a signal input. FIG. 8 illustrates the continuous time loop with such simplified inputs. FIG. 9 is a signal flow graph of the continuous time loop with simple inputs.

For this analysis, assume A=1, so the transfer function between the target and the ECAP is given by:

$\frac{y}{c} = \frac{PG}{s + {PG}}$

And the transfer function between the noise and the ECAP is given by:

$\frac{y}{v} = \frac{PGs}{s + {PG}}$

The transfer function can be shown as the Bode plot of FIG. 10, which gives the frequency response specifications. The heartbeat contribution is attenuated by:

y/v=f _(H) /f _(C)

The noise from the amplifier and from non-evoked responses is assumed to be white and is attenuated by:

y/n=f _(C) /f _(N)

Configuring the loop to have a corner frequency between f_(C) and f_(N) thus attenuates both noise and heartbeat. The loop is adjusted to have a 3 Hz corner frequency at the most sensitive posture, which typically is when the patient is lying supine. At a sample rate of 60 Hz, this provides around 11 dB of noise and movement attenuation at the heartbeat frequency of one beat per second.

FIG. 11 shows the effect of changes in P upon attenuation of noise (1102) and heartbeat attenuation of heartbeat (1104), by the first order continuous time (Laplace) loop. As the patient changes posture, P changes, and with it the loop corner frequency. This change in noise attenuation is offset by the change in movement attenuation as shown in FIG. 11.

Since P can vary by as much as 10:1, the corner frequency can vary by a similar amount, around 10:1. If P falls sufficiently, a point is reached where the heartbeat is not attenuated. If P rises sufficiently, it reaches a point where noise is not attenuated.

Thus, in this embodiment a fitting procedure to fit the operation of the device 100 to the recipient involves choosing the loop corner frequency at the middle of the range of P values shown in FIG. 11. Since this is affecting a filter characteristic, taking the middle of the range as the geometric mean is preferable to the arithmetic mean.

The loop of FIGS. 7-11 uses continuous time to aid explanation, however the actual loop, being of a nature which delivers pulsatile stimuli sampled at 10 kHz, involves sampled data. FIG. 12 shows the frequency characteristics of an equivalent sampled data first order loop. In FIG. 12 the more sensitive postures with larger P, such as the recipient lying supine, occur on the right of the plot where log(P)>0. If the loop corner frequency were to be set while the patient was in the least sensitive posture, such as while lying prone, then movement of the person to other postures will move the loop characteristics to the right in FIG. 12, leading to attenuation of noise, and then even amplification of noise noting that curve 1202 is greater than 0 for log(P)>˜0.5. Such noise amplification has indeed been observed. Accordingly preferred embodiments fit the device while the recipient is in the most sensitive posture, lying supine. Consequently, as the person moves the loop characteristics move to the left, which results in a reduction in heartbeat attenuation.

In another embodiment, the loop gain may be set while the recipient is in the most sensitive posture, but biased somewhat to the right in FIG. 12 as indicated by 1206 to take more advantage of the central portion 1208 of the response where both heartbeat and noise attenuation are low.

The present invention further recognises that a figure of merit for such feedback loops can be defined, by referring to FIG. 11: Figure of Merit=heartbeat attenuation+noise attenuation, at P=1. This sum remains substantially constant for small variations in posture either side of P=1.

FIG. 13 shows the performance of a second-order sampled data loop. Table 1 compares the performance of the first-order continuous, first-order discrete and second order discrete loops, showing that the second order loop performs 3.1 dB better than the first order discrete loop.

TABLE 1 Comparison of loop characteristics Improvement compared to Figure of 1^(st) Order Loop Noise Movement Merit (dB) Discrete Filter Name First order 11.5 9.4 20.9 N/A sfilterx1 continuous First order 9.8 9.3 19.1 0 zfilterx0 discrete Second order 11.0 11.8 22.8 3.7 zfilterx8 discrete

Both the first order and second order sampled data loops amplify noise for P>sqrt(10). The first order loop becomes unstable at P>˜5. The second order loop is unstable at P>sqrt(10).

The details of implementation of an embodiment comprising a second order loop are now described. In this embodiment a second order filter is designed in the s-domain to aid understanding, then transferred to the z-domain for implementation. FIG. 14 illustrates a continuous time model of the second order loop. This loop of FIG. 14 is used in place of that in FIG. 9, in this embodiment. Its transfer function from noise to output is:

$\frac{y}{n} = \frac{PG}{s^{2} - {as} + {PG}}$

The gain from the patient disturbance to the ECAP:

$\frac{y}{v} = \frac{{PGs}\left( {s - a} \right)}{s^{2} - {as} + {PG}}$

These are a low-pass and high-pass response respectively. Considering the equation for a second order filter:

${{Gain}\mspace{11mu} ({lpf})} = \frac{1}{s^{2} - {\omega_{B}s} + \omega_{0}^{2}}$

the corner (resonant) frequency is ω₀=2πf₀ (in radians per second or Hz), so comparing to the equation for the gain from patient disturbance to ECAP, This is critically damped when ω_(B)=1.414 ω₀. So given P, we can choose G such that:

$G = \frac{\left( {2\pi \; f_{0}} \right)^{2}}{P}$ and $a = {2{\sqrt{2} \cdot \pi \cdot f_{0}}}$

The loop was then transformed to the sampled data domain using the bilinear transform to implement each integrator. The bilinear transform approximates a continuous time integrator in the z-domain using the following transfer function, where T is the sample interval.

$\frac{1}{s} = {\frac{T}{2}\frac{z + 1}{z - 1}}$

FIG. 15 illustrates the equivalent second order controller in the z-domain.

Some embodiments may further provide for estimation and compensation for P, as follows. This method estimates P and then using the estimate (P′) adjusts the loop gain as shown in FIG. 16. The estimator uses the current value and the measured ECAP amplitude. The method of solving the problem is easier to explain noting that the control variable x is the stimulus current I and the feedback variable f is the measured ECAP voltage V.

The compensation 1/P′ is added to the loop at a point where the average signal is zero, so as to perturb the loop as little as possible.

Since both P and T vary with distance to the cord, there must exist a relationship between them. The initial estimation of P uses the empirical relationship, for some K: PT=K. Taking the model of the current growth curve:

V=P(I−T)

eliminating T and inverting, gives the estimate P′:

$P = \frac{V + K}{I}$

To give examples of the method for estimation of K, consider the three patients shown in the following tables.

TABLE 2 patient parameters Posture 1 (most sensitive) Posture 2 (least sensitive) Threshold Comfort Threshold Comfort Patient Sensitivity Current Current Sensitivity Current Current Variation I.D. (μV/mA) (mA) (mA) (μv/mA): (mA) (mA) in P A 77 0.8 1 26 3.7 4.5 2.96 B 30 2.7 4.3 20 2.9 3.7 1.50 C 22 4.5 10.6 19 6.1 12.6 1.16

TABLE 3 average values of TP TP Most TP Least Sensitive Sensitive Average (TP) 61.6 96.2 78.9 81 58 69.5 99 115.9 107.45

TABLE 4 P′ estimations of P P′ Most P′ Least Sensitive Sensitive Comfort Max Comfort Max 94.30 90.31 22.16 22.40 27.33 27.60 23.11 22.88 22.80 22.70 18.33 18.40

TABLE 5 variation in P/P′ P/P′ Most P/P′ Least Variation in Sensitive Sensitive P/P′ 1.22 1.17 0.85 0.86 1.44 0.91 0.92 1.16 1.14 0.80 1.04 1.03 0.96 0.97 1.07

Thus, tables 2 to 5 show that the P estimator halves the variation in loop gain with P.

The present invention thus recognises that a system using a feedback loop to maintain a constant ECAP is unusual in that the changes in patient posture create both signal inputs and change the loop characteristics. Choosing an optimum corner frequency for the loop is a tradeoff between obtaining optimum noise rejection and optimum loop speed. This tradeoff is made more challenging with variations in loop gain. Methods have been described above that reduce the extent to which loop gain changes with patient posture, allowing for optimum placement of the loop poles. These methods can be used independently or in conjunction.

A study was conducted to examine the effect of posture changes on pain and on side effects (e.g. over-stimulation and under-stimulation), comparing the use of SCS with feedback (automatic current adjustment) against SCS without feedback (conventional fixed current stimulation). Subjects (n=8) were tested with and without feedback control using the Saluda Medical SCS system on the last day of their commercial system trial (5 to 7 days after lead implantation).

With feedback, stimulation current was adjusted automatically by the Saluda system by maintaining the ECAP at the subject's comfort level. Without feedback, the device delivered a fixed current similar to the commercial devices. SCS control with and without feedback were tested in various postures. Subjects compared the strength of the paraesthesia at each posture to the previous posture with 5-point Likert scales.

Subject pain scores, and stimulation side effects were compared between trial stimulation with the commercial device and Saluda feedback stimulation using 5-point Likert scales.

FIGS. 17a and 17b are graphs showing the observed amplitude of the ECAP in response to the delivery of stimuli over the course of two minutes, during which time the patient changed posture and made movements as indicated. In FIG. 17a , without feedback loop control, it can be seen that a regime of stimuli delivered at a constant amplitude produce ECAPs which vary considerably in amplitude, between zero and 750 uV. In particular, it is noted that this patient received no pain relief when the ECAP amplitude was below therapeutic threshold 1702, so that it can be seen from FIG. 17a that the constant stimulus therapy was mostly failing to deliver pain relief while the patient was standing or lying prone. On the other hand, the comfort threshold 1704 for this patient was also regularly exceeded by the observed ECAP amplitude, in particular at times when the patient was positioning to stand, briefly while prone, during a cough and while taking a deep breath, and repeatedly while walking.

In contrast, in FIG. 17b when ECAPs were recorded with the feedback loop actively controlling the amplitude of the applied stimuli, and while the patient repeated the same sequence of actions, the ECAP amplitudes are kept almost entirely within the therapeutic window, above therapeutic threshold 1702 and below comfort threshold 1704. The occurrence of evoked responses in the overstimulation region above threshold 1704 has been eliminated entirely, while the occurrence of non-therapeutic responses having an amplitude below threshold 1702 has been significantly reduced compared to FIG. 17a .

Data of the type shown in FIGS. 17a and 17b , from seven subjects, was processed to determine the variation of the ECAP response from the comfort level, calculated as root mean square (rms) and shown in FIG. 18. The rightmost columns of FIG. 18 show that on average amongst these seven subjects there was 30% variation from the comfort level when feedback was enabled, but more than 70% variation from the comfort level without feedback.

FIG. 19 shows a subjective comparison between feedback and non-feedback. This shows that with feedback, 90% of the subjects have improved pain relief (and no worse side effects) or less side effects (and no worse pain relief).

FIG. 20 illustrates subjective data obtained from one patient showing that, as is desirable, the paraesthesia strength has much less variation in every movement or change of posture tested when feedback is enabled, as compared to without feedback.

In FIG. 21 the variation in paraesthesia strength across postures was rated from 0% (no change for any posture) to 100% (much stronger or much weaker at each posture). With feedback the perceived variation in paraesthesia strength was significantly (P<0.001) reduced, by 30% as compared to without feedback.

The study of FIGS. 17-21 thus shows that there is a clear correlation between the variation of the response with feedback compared to non-feedback, both when determined directly from measured spinal cord potentials and when determined from the qualitative assessment of the subjects. 87% of the subjects had less side effects with either no difference in pain relief or better pain relief with feedback control, compared with conventional stimulation.

The described electronic functionality can be implemented by discrete components mounted on a printed circuit board, or by a combination of integrated circuits, or by an application-specific integrated circuit (ASIC).

It will be appreciated by persons skilled in the art that numerous variations and/or modifications may be made to the invention as shown in the specific embodiments without departing from the spirit or scope of the invention as broadly described. The present embodiments are, therefore, to be considered in all respects as illustrative and not limiting or restrictive. PRELIMINARY AMENDMENT 

1. A method of controlling a neural stimulus, the method comprising: applying the neural stimulus to a neural pathway in order to give rise to an evoked action potential on the neural pathway, the stimulus being defined by at least one stimulus parameter; measuring a neural compound action potential response evoked by the stimulus, and deriving from the measured evoked response a feedback variable; completing a feedback loop by using the feedback variable to control the at least one stimulus parameter value; and adaptively compensating for changes in a gain of the feedback loop caused by electrode movement relative to the neural pathway.
 2. The method of claim 1 wherein adaptively compensating for changes in the feedback loop comprises maintaining a corner frequency of the feedback loop at a desired value or within a desired range.
 3. The method of claim 2 wherein the desired value or range of the corner frequency is selected to suitably attenuate low frequency noise such as heartbeat as well as high frequency noise such as electrical amplifier noise.
 4. The method of claim 2 wherein the desired value or range of the corner frequency is selected to bias attenuation of heartbeat and noise while the recipient is in a more or most sensitive posture.
 5. The method of claim 1 wherein the feedback loop is a first order feedback loop.
 6. The method of claim 1 wherein the feedback loop is a second order feedback loop.
 7. The method of claim 1 further comprising determining an estimate P′ of a slope P of a current ECAP growth curve.
 8. The method of claim 7 wherein the estimation P′ is produced from an empirical relationship of stimulus current to measured ECAP amplitude.
 9. The method of claim 7 wherein the estimation P′ is estimated as P′=(V+K)/I, where V is ECAP amplitude, K is a constant or function which relates P to a stimulus threshold T, and I is stimulus current amplitude.
 10. The method of claim 7 wherein the estimate P′ is introduced into the feedback loop to counteract the effect of P.
 11. The method of claim 10 wherein an error signal of the feedback loop is scaled by 1/P′.
 12. The method of claim 1 wherein the feedback variable is an amplitude measure of the evoked compound action potential.
 13. The method of claim 1 wherein the stimulus parameter is stimulus current.
 14. The method of claim 1 wherein the set point of the feedback loop is configured so as to seek a constant value of ECAP amplitude.
 15. The method of claim 1 wherein the set point of the feedback loop is configured so as to seek a target ECAP amplitude which changes over time as defined by a therapy map.
 16. An implantable device for controllably applying a neural stimulus, the device comprising: a plurality of electrodes including one or more nominal stimulus electrodes and one or more nominal sense electrodes; a stimulus source for providing a stimulus to be delivered from the one or more stimulus electrodes to a neural pathway in order to give rise to an evoked action potential on the neural pathway; measurement circuitry for recording a neural compound action potential signal sensed at the one or more sense electrodes; and a control unit configured to: control application of a neural stimulus as defined by at least one stimulus parameter; measure via the measurement circuitry a neural compound action potential response evoked by the stimulus; determine from the measured evoked response a feedback variable; complete a feedback loop by using the feedback variable to control the at least one stimulus parameter value; and adaptively compensate for changes in a gain of the feedback loop caused by electrode movement relative to the neural pathway.
 17. A non-transitory computer readable medium for controllably applying a neural stimulus, comprising the following instructions for execution by one or more processors: computer program code means for applying the neural stimulus to a neural pathway in order to give rise to an evoked action potential on the neural pathway, the stimulus being applied as defined by at least one stimulus parameter; computer program code means for measuring a neural compound action potential response evoked by the stimulus and deriving from the measured evoked response a feedback variable; computer program code means for completing a feedback loop by using the feedback variable to control the at least one stimulus parameter value; and computer program code means for adaptively compensating for changes in a gain of the feedback loop caused by electrode movement relative to the neural pathway. 